//
//  ViewController.m
//  LSLColorPickerDemo
//
//  Created by Bruce Li on 15/12/27.
//  Copyright © 2015年 longshao. All rights reserved.
//

#import "ViewController.h" 
#import "LSLHSBColorPicker.h"

@interface ViewController ()

@property (nonatomic, strong) LSLHSBColorPicker *colorPickerView;//颜色选择器的视图
@property (nonatomic, strong)UIView *LSLHSBColorPickerView;
@property (weak, nonatomic) IBOutlet UIView *testView;

@property (weak, nonatomic) IBOutlet UIView *contentView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _colorPickerView = [[LSLHSBColorPicker alloc] init];
    
    _LSLHSBColorPickerView = [[[NSBundle mainBundle]loadNibNamed:@"LSLHSBColorPicker" owner:nil options:nil]lastObject];
    
    _LSLHSBColorPickerView.frame = CGRectMake(0, 0, _contentView.frame.size.height, _contentView.frame.size.width);
    
    [self.view addSubview: _contentView];
    
    [_LSLHSBColorPickerView addSubview:_colorPickerView];
    
    [_contentView addSubview:_LSLHSBColorPickerView];
    
    __weak typeof(self) weakSelf = self;
    
    [_colorPickerView colorSelectedBlock:^(UIColor *color, BOOL isConfirm) {
        /// do something...
        ///
        weakSelf.testView.backgroundColor = color;
    }];
}

- (void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];
    self.colorPickerView.frame = self.contentView.bounds;
}

@end
